package com.bdqn.service;

import com.bdqn.mapper.SysRoleMapper;
import com.bdqn.pojo.SysRole;
import com.bdqn.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统角色服务层实现类
 *
 * @author LILIBO
 * @since 2021-11-18
 */
public class SysRoleServiceImpl implements SysRoleService {

    private Logger logger = Logger.getLogger(SysRoleServiceImpl.class);

    /**
     * 获取所有角色
     *
     * @return
     */
    @Override
    public List<SysRole> getList() {
        List<SysRole> list = new ArrayList<>();
        SqlSession sqlSession = MyBatisUtil.createSqlSession();
        try {
            list = sqlSession.getMapper(SysRoleMapper.class).getList();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            MyBatisUtil.closeSqlSession(sqlSession);
        }
        return list;
    }
}
